package com.mgkj.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mgkj.entity.Purtg;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @author : ssy
 * @date: 2024-02-28
 * @Description:
 */
@Mapper
public interface PURTGMapper extends BaseMapper<Purtg> {

    @DS("demo")
    @Select("SELECT MG004 " +
            "FROM CMSMF "  +
            "LEFT JOIN CMSMG ON MF001 = MG001 \n" +
            "WHERE MF001 =  #{ma021} \n" +
            "AND MG002 = (SELECT MAX(MG002) FROM CMSMG) ")
    Map<String, Object> selectHL(String ma021);

    @DS("demo")
    Boolean insertPurtg(Purtg purtg);

    @DS("demo")
    @Delete("DELETE FROM PURTG where TG001 = #{tg001} and TG002 = #{tg002} and TG003 = #{tg003}")
    void deletePurtg(Purtg purtg);
}
